package com.example.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.dao.AddressDao;
import com.example.dao.HouseDao;
import com.example.entity.Address;
import com.example.entity.House;
import com.example.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * (Address)表服务实现类
 *
 * @author makejava
 * @since 2024-06-27 21:57:02
 */
@Service("addressService")
public class AddressServiceImpl extends ServiceImpl<AddressDao, Address> implements AddressService {

    @Autowired
    private HouseDao houseDao;

    @Override
    public void insertAddress(int i, boolean flag) {
        House house = new House();
        house.setId(i);
        house.setName("兴昌佳苑");
        int insert = houseDao.insert(house);
        if (!flag){
            throw new RuntimeException("发生错误");
        }
        Address address = new Address();
        address.setId(i);
        address.setAddress("北京市昌平区");
        int insert1 = baseMapper.insert(address);
    }

}

